package com.xuecheng.rabbitmq.mq;

import com.rabbitmq.client.Channel;
import com.xuecheng.rabbitmq.config.RabbitConfig;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author: gongfy
 * @create: 2020/7/15 20:04
 * @Description:
 */
@Component
public class ReceiveHandler {

    // 监听消息队列
    @RabbitListener(queues = {RabbitConfig.QUEUE_INFORM_EMAIL})
    public void receviMessage(String msg, Message message, Channel channel){
        System.out.println("receive msg:"+msg);
    }

    @RabbitListener(queues = {RabbitConfig.QUEUE_INFORM_SMS})
    public void receive_sms(String msg, Message message, Channel channel){
        System.out.println(msg);
    }
}
